Skip to content

Feat: add query client for stamp status invalidation#150

Merged
skyblue1232 merged 2 commits intodevelopfrom
fix/#149/stamp-query-key
Nov 16, 2025
Merged

Feat: add query client for stamp status invalidation#150
skyblue1232 merged 2 commits intodevelopfrom
fix/#149/stamp-query-key

Conversation

@jjangminii
Copy link
Contributor

@jjangminii jjangminii commented Nov 16, 2025

🔥 작업 내용

  • ex) 로그인 페이지 UI 및 반응형 구현

🤔 추후 작업 사항

  • ex) 소셜 로그인 연동 (카카오, 구글)

🔗 이슈

  • close #

PR Point (To Reviewer)

  • ex) 로그인 입력 검증 로직 적절한지 확인 부탁드립니다.

📸 피그마 스크린샷 or 기능 GIF

(작업 내역 스크린샷)

Summary by CodeRabbit

릴리스 노트

  • 버그 수정
    • 스탬프 획득 직후 상태 정보(스탬프 상태) 갱신이 즉시 반영되도록 개선
    • 위치 처리 안정성 강화(고정 좌표 사용으로 위치 관련 오류 감소)
    • 스탬프 버튼 주변 UI 미세 조정으로 표시/간격 개선
    • 로그인 및 오류 처리 흐름은 기존과 동일하게 유지됨

@jjangminii jjangminii linked an issue Nov 16, 2025 that may be closed by this pull request
@vercel
Copy link

vercel bot commented Nov 16, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
af-fe Ready Ready Preview Comment Nov 16, 2025 0:01am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 16, 2025

Walkthrough

React Query의 useQueryClient를 도입해 스탬프 획득 성공 시 stampStatus 쿼리를 무효화하도록 추가했고, 기기 GPS 좌표 대신 고정된 위도/경도 값을 요청 본문에 사용하도록 변경했습니다.

Changes

Cohort / File(s) 요약
스탬프 획득 및 캐시 무효화
src/pages/main/node/[placeId].tsx
useQueryClient 임포트 및 초기화 추가, 스탬프 획득 성공 후 'stampStatus' 쿼리 무효화(queryClient.invalidateQueries) 호출 추가
위치 정보 변경
src/pages/main/node/[placeId].tsx
동적 기기 위치(pos.coords) 사용을 중단하고 요청 본문에 고정 위도/경도 값으로 대체

Sequence Diagram(s)

sequenceDiagram
    participant UI as UI (스탬프 버튼)
    participant Page as [placeId].tsx
    participant API as Stamp API
    participant QClient as React Query Client

    UI->>Page: 스탬프 요청
    Page->>API: acquireStamp POST { lat: <fixed>, lng: <fixed>, ... }
    alt 성공
        API-->>Page: 200 OK
        Page->>QClient: invalidateQueries('stampStatus')
        Page-->>UI: 성공 상태 표시 / 새 데이터 반영
    else 오류
        API-->>Page: 에러
        Page-->>UI: 에러 처리(로그인/알림)
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • 단일 파일 변경, 패턴이 표준적임
  • 검토 시 유의할 점:
    • 고정 좌표 사용 의도(테스트/제한) 확인
    • invalidateQueries 호출이 적절한 키('stampStatus')와 타이밍에 실행되는지 확인

Possibly related PRs

Suggested reviewers

  • skyblue1232
  • KongMezu

Poem

🐰 고정된 좌표로 땅을 딛고,
캐시 한 번 흔들어 새로이,
스탬프는 찍히고, 화면은 반짝,
당근 한 입, 커밋은 가볍게 ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning PR 설명이 제공된 템플릿 구조를 따르고 있지만, 모든 필수 섹션이 실제 내용 없이 비어있거나 예시만 포함되어 있습니다. 작업 내용, 이슈 번호, 리뷰어를 위한 포인트 등이 채워지지 않았습니다. PR 설명에 실제 작업 내용, 관련 이슈 번호(close #149), 리뷰어를 위한 구체적인 포인트를 추가하십시오.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed PR 제목이 변경사항의 핵심을 명확하게 설명하고 있습니다. 'query client'를 추가하여 'stamp status invalidation'을 수행하는 것이 주요 변경사항이며, 제목이 이를 정확하게 반영하고 있습니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/#149/stamp-query-key

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a849c36 and 0b221bf.

📒 Files selected for processing (1)
  • src/pages/main/node/[placeId].tsx (4 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/pages/main/node/[placeId].tsx (1)
src/shared/hooks/useUserStatus.ts (1)
  • useUserStatus (7-66)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-and-deploy
🔇 Additional comments (2)
src/pages/main/node/[placeId].tsx (2)

19-19: React Query 통합이 올바르게 구현되었습니다.

useQueryClient 훅을 적절하게 import하고 컴포넌트 최상위에서 초기화하여 스탬프 획득 후 캐시 무효화를 위한 준비가 잘 되어 있습니다.

Also applies to: 27-27


95-95: 검증 완료: 쿼리 키 'stampStatus'의 일관성이 확인되었습니다.

src/shared/main/queries/useGetStampStatus.ts에서 queryKey: ['stampStatus']로 정의된 것과 src/pages/main/node/[placeId].tsx 95줄의 무효화 호출이 정확하게 일치합니다. 캐시 무효화 로직이 올바르게 구현되어 있으며, React Query는 동일한 queryKey를 통해 스탬프 상태 캐시를 정상적으로 무효화할 것입니다.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added the feat 새로운 기능 추가 / 퍼블리싱 label Nov 16, 2025
@github-actions
Copy link

🏷️ Labeler has automatically applied labels based on your PR title, branch name, or commit message.
Please verify that they are correct before merging.

@github-actions github-actions bot added the comment 필요한 주석 추가 및 변경 label Nov 16, 2025
@github-actions
Copy link

🏷️ Labeler has automatically applied labels based on your PR title, branch name, or commit message.
Please verify that they are correct before merging.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/pages/main/node/[placeId].tsx (1)

1-1: Pages Router에서 'use client' 지시문을 제거하세요.

이 프로젝트는 Next.js Pages Router를 사용하므로 'use client' 지시문이 필요하지 않습니다. 이 지시문은 App Router 전용이며, Pages Router의 pages/ 디렉토리에 있는 컴포넌트는 기본적으로 클라이언트 컴포넌트입니다.

Based on learnings

다음 diff를 적용하여 제거하세요:

-'use client';
 import { useState, useEffect } from 'react';
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 20c93ab and a849c36.

📒 Files selected for processing (1)
  • src/pages/main/node/[placeId].tsx (4 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-31T17:34:04.352Z
Learnt from: jjangminii
Repo: geulDa/FE PR: 64
File: src/pages/map/result/components/ResultMap.tsx:3-3
Timestamp: 2025-10-31T17:34:04.352Z
Learning: The geulDa/FE project uses Next.js Pages Router (not App Router), so components should import useRouter from 'next/router' and should not use the 'use client' directive.

Applied to files:

  • src/pages/main/node/[placeId].tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-and-deploy
🔇 Additional comments (1)
src/pages/main/node/[placeId].tsx (1)

19-19: 캐시 무효화 로직이 올바르게 구현되었습니다.

React Query의 useQueryClient를 사용하여 스탬프 획득 성공 후 stampStatus 쿼리를 무효화하는 패턴이 정확합니다. 이를 통해 UI가 최신 스탬프 상태를 반영할 수 있습니다.

Also applies to: 71-71, 95-95

Comment on lines 81 to 86
getLocation(
(pos) => {
const body = {
latitude: 37.52146604044732,
latitude: 37.52146604044732,
longitude: 126.76740151260397,
// 실제 위치 사용 시:
// latitude: pos.coords.latitude,
// longitude: pos.coords.longitude,
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

하드코딩된 좌표로 인해 위치 기반 검증이 우회됩니다.

getLocation()을 호출하여 사용자의 실제 위치를 받아오지만, 받은 pos 파라미터를 사용하지 않고 하드코딩된 좌표를 전송하고 있습니다. 이로 인해:

  • 위치 기반 스탬프 획득 검증이 완전히 무력화됩니다
  • 사용자에게 불필요하게 위치 권한을 요청합니다
  • 테스트/디버그 코드가 프로덕션에 머지될 위험이 있습니다

이것이 의도된 테스트 코드인지 확인이 필요합니다. 프로덕션에 배포할 경우, 실제 사용자 위치를 사용하도록 수정해야 합니다:

 const body = {
-  latitude: 37.52146604044732,
-  longitude: 126.76740151260397,
+  latitude: pos.coords.latitude,
+  longitude: pos.coords.longitude,
 };

또는 테스트 목적이라면, 별도의 feature flag나 환경 변수로 분리하는 것을 권장합니다.

🤖 Prompt for AI Agents
In src/pages/main/node/[placeId].tsx around lines 81 to 86, the callback to
getLocation ignores the received pos and sends hardcoded coordinates which
bypasses location-based validation; replace the hardcoded latitude/longitude
with the actual pos values (e.g., pos.coords.latitude and pos.coords.longitude)
so the app uses the user’s real location, and if those literal coordinates were
left for testing wrap the behavior behind a feature flag or environment variable
(or remove before prod); confirm intent and ensure location-permission flow and
error handling remain correct when using pos.

@jjangminii jjangminii changed the title feat: add query client for stamp status invalidation Feat: add query client for stamp status invalidation Nov 16, 2025
@skyblue1232 skyblue1232 merged commit b196361 into develop Nov 16, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comment 필요한 주석 추가 및 변경 feat 새로운 기능 추가 / 퍼블리싱

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[fix] 스탬프 쿼리키 관리

2 participants